<?php


namespace app\admin\model;


use app\common\model\TimeModel;
use think\Model;

class SystemConfig extends TimeModel
{


    public static function onAfterRead(Model $model)
    {
//        if($model->type=='html'){
//            $model->value2 = html_entity_decode($model->value);
//        }
    }

    public function getConfig($name = true){
        if ($name === true) {
            return $this->where('hide', 0)->column('value', 'name') ?? false;
        } elseif (is_int($name)) {
            return $this->where('id', $name)->value('value') ?? false;
        } elseif (is_string($name)) {
            return $this->where('name', $name)->value('value') ?? false;
        }
    }

}